![]() |
PATH![]() |
The USBDelay function calls back through the normal completion mechanism when the specified number of frames have passed. There is up to an extra one frame delay to accommodate synchronizing with USB frames. For example, 0 frames delay means after the current frame, which could be up to 1 ms plus any other system delays.
OSStatus USBDelay(USBPB *pb);
Required fields in the USBPB parameter block for the USBDelay function are
The usbFlags parameter can be used to request a call back at task level. A requested delay of kUSBNoDelay causes the call back to occur as soon as possible during system task level (as opposed to secondary interrupt level). Thus effecting a transition to task level. If you specify kUSBNoDelay you are not guaranteed a callback will occur at task time unless the kUSBTaskTimeFlag is set.
The USBDelay function should not be used as a system-wide timing mechanism, since the time values are only relevant within the context of USB frames. The Mac OS USB software guarantees that only the specified number of frames will pass over the USB before the completion routine executes. It will never be less than the specified length of delay. Other activity affecting the system may determine how long it actually takes for a specified number of frames to pass. The functions in the Driver Services library provide accurate timing services for native drivers.
There must be a valid USBReference passed in the usbReference field of the parameter block. If a nil value or a reference that does not match an existing device, interface, or pipe is passed in, the call returns immediately with an unknown device error.
If the device associated with this call is unplugged and its driver removed while this function call is pending, the delay is cancelled and the function will not complete. Your finalize routine can assume that the delay is finished and safely dispose of the parameter block.
The USBDelay function returns the following error:
kUSBUnknownDeviceErr
|
-6998 | usbReference does not refer to a current device |
Previous | Back Up One Level | Next | Show Frames | Hide Frames